﻿using DevExpress.XtraGrid.Demos.util;
using DevExpress.XtraReports.UI;
using DiaoPaiDaYin;
using DXApplicationTangche.DTO;
using DXApplicationTangche.report;
using DXApplicationTangche.service;
using DXApplicationTangche.UC.下单MTO.Service;
using DXApplicationTangche.UC.成品出库单.service;
using DXApplicationTangche.UC.订单.service;
using DXApplicationTangche.UC.订单一览新.订单预览新.service;
using DXApplicationTangche.Utils;
using mendian;
using System;
using System.Collections.Generic;
using System.Data;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace DXApplicationTangche.UC.订单一览新.销售确认单
{
    public class 销售确认Service
    {
        public static void 调用QC(String mobile, String address, Boolean 定制下单, String id)
        {
            List<String> defectCodes = new List<string>();
            //  判断电话是否为空
            //  判断是否是定制下单
            if (String.IsNullOrEmpty(address))
                saveCustomerDailyDefect(mobile, "补充客户地址");
            if (定制下单)
                defectCodes.Add("补充定制信息");
            //  TODO
            if (defectCodes.Count != 0)
            {
                saveOrderDefect(mobile, id, defectCodes);
            }
        }

        /// <summary>
        /// 定制下单暂存带成单人及支付方式 
        /// </summary>
        public static List<String> saveCustomerMadeSaleCacheWith(
            String mobile,
            String store,
            String assistant,
            String sales,
            String paymentType,
            List<CustomerMadeSaleConfirmDTO> customerMadeSaleConfirmDTOS)
        {
            return
            FunctionHelper.JsonDeserialization<List<String>>(
                                RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/saveCustomerMadeSaleCacheWith?mobile=" + mobile + "&store=" + store + "&assistant=" + assistant + "&sales=" + sales + "&paymentType=" + paymentType,
                        FunctionHelper.JsonSerialization(customerMadeSaleConfirmDTOS)
                        ));
        }

        /// <summary>
        /// 由时间和电话查询定制和客套销售确认单
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static Double getAccountBalance(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<Double>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getAccountBalance?mobile=" + mobile)
                    );
        }
        /// <summary>
        /// 根据电话查询预存余额及会员类型
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static AccountBalanceAndMerbershipDTO getAccountBalanceAndMerbershipByMobile(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<AccountBalanceAndMerbershipDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getAccountBalanceAndMerbershipByMobile?mobile=" + mobile)
                    );
        }
        /// <summary>
        /// 客户余额
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static List<SaleConfirmQueryTitileDTO> getSaleConfirmListByDateTimeStrAndMobile(String dateTimeStr, String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmQueryTitileDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmListByDateTimeStrAndMobile?dateTimeStr=" + dateTimeStr + "&mobile=" + mobile)
                    );
        }
        /// <summary>
        /// 销售日记账每日预览
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <returns></returns>
        public static List<SaleConfirmQueryTitileDTO> getSaleConfirmListByDateTimeStr(String dateTimeStart, String dateTimeEnd)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmQueryTitileDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmListByDateTimeStr?dateTimeStart=" + dateTimeStart + "&dateTimeEnd=" + dateTimeEnd)
                    );
        }

        /// <summary>
        /// 由电话查询当天定制和客套销售确认单
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static List<SaleConfirmQueryTitileDTO> getDaySaleConfirmListByMobile(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmQueryTitileDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getDaySaleConfirmListByMobile?&mobile=" + mobile)
                    );
        }
        public static SaleConfirmQueryTitileWithBalanceDTO getDaySaleConfirmListWithBalanceByMobile(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<SaleConfirmQueryTitileWithBalanceDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getDaySaleConfirmListWithBalanceByMobile?&mobile=" + mobile)
                    );
        }
        /// <summary>
        /// 查询时间段内客户整体调价
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="dateTimeEnd"></param>
        /// <returns></returns>
        public static SalesQCItemQueryFacadeDTO findViewCustomerDailyAdjustListBySaleDateBetween(String dateTimeStr, String dateTimeEnd)
        {
            return
                FunctionHelper.JsonDeserialization<SalesQCItemQueryFacadeDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/findViewCustomerDailyAdjustListBySaleDateBetween?dateTimeStr=" + dateTimeStr + "&dateTimeEnd=" + dateTimeEnd)
                    );
        }
        /// <summary>
        /// 待补充定制销售日记账一览
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="dateTimeEnd"></param>
        /// <returns></returns>
        public static List<ViewCustomerDailyAdjustDTO> findUnConfirmCustmerMadeOrder()
        {
            return
                FunctionHelper.JsonDeserialization<List<ViewCustomerDailyAdjustDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/findUnConfirmCustmerMadeOrder")
                    );
        }
        /// <summary>
        /// 查询销售qc项目
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="dateTimeEnd"></param>
        /// <returns></returns>
        public static SalesQCItemQueryFacadeDTO getSalesQCItemByDateStamp(String dateTimeStr, String dateTimeEnd)
        {
            return
                FunctionHelper.JsonDeserialization<SalesQCItemQueryFacadeDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSalesQCItemByDateStamp?dateTimeStr=" + dateTimeStr + "&dateTimeEnd=" + dateTimeEnd)
                    );
        }
        /// <summary>
        /// 由时间和电话查询客户未同步的定制销售确认单
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static List<SaleConfirmQueryTitileDTO> getSaleConfirmListByBusinessTypeAndSynchronizeFalseAndMobileAndOrderDateBetween(String dateTimeStr, String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmQueryTitileDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmListByBusinessTypeAndSynchronizeFalseAndMobileAndOrderDateBetween?dateTimeStr=" + dateTimeStr + "&mobile=" + mobile)
                    );
        }

        /// <summary>
        /// 现货销售商品调价
        /// </summary>
        /// <param name="saleAdjustDTO"></param>
        /// <returns></returns>
        public static SaleAdjustDTO saveSaleAdjust(SaleAdjustDTO saleAdjustDTO)
        {
            return
                FunctionHelper.JsonDeserialization<SaleAdjustDTO>(
                    RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/saveSaleAdjust",
                        FunctionHelper.JsonSerialization(saleAdjustDTO)
                        )
                    );
        }
        /// <summary>
        /// 保存设计费用
        /// </summary>
        /// <param name="saleAdjustDTO"></param>
        /// <returns></returns>
        public static SaleAdjustDTO saveDeignExpenses(SaleAdjustDTO saleAdjustDTO)
        {
            return
                FunctionHelper.JsonDeserialization<SaleAdjustDTO>(
                    RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/saveDeignExpenses",
                        FunctionHelper.JsonSerialization(saleAdjustDTO)
                        )
                    );
        }
        /// <summary>
        /// 现货销售积分抵值
        /// </summary>
        /// <param name="saleAdjustDTO"></param>
        /// <returns></returns>
        public static 下单MTO.Service.PlainMessageResult saveSaleScoreAdjust(SaleAdjustDTO saleAdjustDTO)
        {
            return
                FunctionHelper.JsonDeserialization<下单MTO.Service.PlainMessageResult>(
                    RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/saveSaleScoreAdjust",
                        FunctionHelper.JsonSerialization(saleAdjustDTO)
                        )
                    );
        }

        /// <summary>
        /// 查找客户每日调价
        /// </summary>
        /// <param name="dateStamp"></param>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static CustomerDailyDiscountDTO getCustomerDailyDiscountByDateStampAndMobile(String dateStamp, String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<CustomerDailyDiscountDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getCustomerDailyDiscountByDateStampAndMobile?dateStamp=" + dateStamp + "&mobile=" + mobile
                        )
                    );
        }

        /// <summary>
        /// 保存客户每日调价
        /// </summary>
        /// <param name="customerDailyDiscountDTO"></param>
        /// <returns></returns>
        public static DTO返回值判断 saveCustomerDailyDiscount(CustomerDailyDiscountDTO customerDailyDiscountDTO)
        {
            return
                FunctionHelper.JsonDeserialization<DTO返回值判断>(
                    RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/saveCustomerDailyDiscount",
                        FunctionHelper.JsonSerialization(customerDailyDiscountDTO)
                        )
                    );
        }

        public static List<SalesAssistantDTO> get销售员带助记码()
        {
            return
                FunctionHelper.JsonDeserialization<List<SalesAssistantDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/store/getSalesAssistantList"
                        )
                    );
        }
        /// <summary>
        /// 获取销售日记账视图一览
        /// </summary>
        /// <returns></returns>
        public static List<ViewSaleInfoDTO> getRecentViewSaleInfo()
        {
            return
                FunctionHelper.JsonDeserialization<List<ViewSaleInfoDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getRecentViewSaleInfo"
                        )
                    );
        }
        /// <summary>
        /// 生成客户每日异常记录
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="defectCode"></param>
        public static void saveCustomerDailyDefect(String mobile, String defectCode)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/saleConfirm/saveCustomerDailyDefect?mobile=" + mobile + "&defectCode=" + defectCode);
        }
        /// <summary>
        /// 生成销售订单异常记录
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="salComfirmId"></param>
        /// <param name="defectCodes"></param>
        public static void saveOrderDefect(String mobile, String salComfirmId, List<String> defectCodes)
        {
            RestCall.PostHttp(
                URL.接口url + "/saleConfirm/saveOrderDefect?mobile=" + mobile + "&salComfirmId=" + salComfirmId,
                FunctionHelper.JsonSerialization(defectCodes)
                );
        }
        /// <summary>
        /// 关闭qc项目
        /// </summary>
        /// <param name="qcItemIds"></param>
        public static void qcItemCloseBySalComfirmIds(List<String> salComfirmIds)
        {
            RestCall.PostHttp(
                URL.接口url + "/saleConfirm/qcItemCloseBySalComfirmIds",
                FunctionHelper.JsonSerialization(salComfirmIds)
                );
        }
        /// <summary>
        /// 查询销售订单下的生产订单、工序、异常、发运记录
        /// </summary>
        /// <param name="saleConfirmIds"></param>
        /// <returns></returns>
        public static SaleConfirmInfoDTO getSaleShippingBySaleConfirmId(List<String> saleConfirmIds)
        {
            return
                FunctionHelper.JsonDeserialization<SaleConfirmInfoDTO>(
                    RestCall.PostHttp(
                        URL.接口url + "/saleConfirm/getSaleShippingBySaleConfirmId",
                        FunctionHelper.JsonSerialization(saleConfirmIds)
                        )
                    );
        }
        /// <summary>
        /// 最新销售记录
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public static RefSaleRecordDTO getSaleReordByBarcode(String barcode)
        {
            return
                FunctionHelper.JsonDeserialization<RefSaleRecordDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleReordByBarcode?barcode=" + barcode
                        )
                    );
        }
        /// <summary>
        /// 根据成衣条码找销售信息
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public static SaleConfirmQueryWholeDTO getSaleConfirmWholeByBarcode(String barcode)
        {
            return
                FunctionHelper.JsonDeserialization<SaleConfirmQueryWholeDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmWholeByBarcode?barcode=" + barcode
                        )
                    );
        }

        /// <summary>
        /// 更新退货带条码带辅销售 
        /// </summary>
        /// <param name="id"></param>
        /// <param name="store"></param>
        /// <param name="assistant"></param>
        /// <param name="remarks"></param>
        public static void saleReturnByBarcodeWithSales(String id, String barcode, String store, String assistant, String sales, String paymentType, String remarks)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/saleConfirm/saleReturnByBarcodeWithSales?id=" + id + "&barcode=" + barcode + "&store=" + store + "&assistant=" + assistant + "&sales=" + sales + "&paymentType=" + paymentType + "&remarks=" + remarks
                );
        }
        /// <summary>
        /// 根据电话判断客户标签是否存在
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static Boolean judgePresentByMobile(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<Boolean>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/customer/judgePresentByMobile?mobile=" + mobile
                        )
                    );
        }
        /// <summary>
        /// 关闭个人QC项目
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="defectCode"></param>
        public static void qcItemCloseByCustomer(String mobile, String defectCode)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/saleConfirm/qcItemCloseByCustomer?mobile=" + mobile + "&defectCode=" + defectCode
                );
        }
        /// <summary>
        /// 根据时间戳查询整体调价
        /// </summary>
        /// <param name="dateStamp"></param>
        /// <returns></returns>
        public static List<ViewCustomerDailyAdjustDTO> getViewCustomerDailyAdjustByDateStamp(String dateStamp)
        {
            return
                FunctionHelper.JsonDeserialization<List<ViewCustomerDailyAdjustDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getViewCustomerDailyAdjustByDateStamp?dateStamp=" + dateStamp
                        )
                    );
        }
        /// <summary>
        /// 关闭个人每日QC项目
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="dateStamp"></param>
        /// <param name="defectCode"></param>
        public static void qcItemCloseByCustomerDaily(String mobile, String dateStamp, String defectCode)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/saleConfirm/qcItemCloseByCustomerDaily?mobile=" + mobile + "&dateStamp=" + dateStamp + "&defectCode=" + defectCode
                );
        }
        /// <summary>
        /// 关闭当日QC项目
        /// </summary>
        /// <param name="dateStamp"></param>
        /// <param name="defectCode"></param>
        public static void qcItemCloseByDateStamp(String dateStamp, String defectCode)
        {
            RestCall.httpGetMethod(
                URL.接口url + "/saleConfirm/qcItemCloseByDateStamp?dateStamp=" + dateStamp + "&defectCode=" + defectCode
                );
        }
        /// <summary>
        /// 销售日记账整体预览
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public static List<SaleConfirmExportDTO> getSaleConfirmExportListByDateTimeStr(String dateTimeStart, String dateTimeEnd)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmExportDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmExportListByDateTimeStr?dateTimeStart=" + dateTimeStart + "&dateTimeEnd=" + dateTimeEnd
                        )
                    );
        }
        /// <summary>
        /// 根据条码找销售订单信息
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public static CustomerTagQueryFacadeDTO getCustomerTagRecordByBarcode(String barcode)
        {
            return
                FunctionHelper.JsonDeserialization<CustomerTagQueryFacadeDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/barcode/getCustomerTagRecordByBarcode?barcode=" + barcode
                        )
                    );
        }
        /// <summary>
        /// 查询时间段内客套销售账
        /// </summary>
        /// <param name="dateTimeStr"></param>
        /// <param name="dateTimeEnd"></param>
        /// <returns></returns>
        public static List<SaleConfirmQueryTitileDTO> getSaleConfirmListOrderDateBetween(String dateTimeStr, String dateTimeEnd)
        {
            return
                FunctionHelper.JsonDeserialization<List<SaleConfirmQueryTitileDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleConfirmListOrderDateBetween?dateTimeStr=" + dateTimeStr + "&dateTimeEnd=" + dateTimeEnd
                        )
                    );
        }
        /// <summary>
        /// 根据销售订单Id找销售订单信息
        /// </summary>
        /// <param name="saleOrderDetailId"></param>
        /// <param name="saleConfirmId"></param>
        /// <returns></returns>
        public static CustomerTagQueryFacadeDTO getCustomerTagRecordBySaleConfirmId(String saleOrderDetailId, String saleConfirmId)
        {
            return
                FunctionHelper.JsonDeserialization<CustomerTagQueryFacadeDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getCustomerTagRecordBySaleConfirmId?saleOrderDetailId=" + saleOrderDetailId + "&saleConfirmId=" + saleConfirmId
                        )
                    );
        }

        /// <summary>
        /// 查找客户最近30天的MTO以销定产记录
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static List<CustomerSaleQueryDTO> getRecentCustomerMTOInfo(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<List<CustomerSaleQueryDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getRecentCustomerMTOInfo?mobile=" + mobile
                        )
                    );
        }
        /// <summary>
        /// 获取客户凭证
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static CustomerSaleOrderReportDTO getViewSaleInfoDaoByMobile(String saleId)
        {
            return
                FunctionHelper.JsonDeserialization<CustomerSaleOrderReportDTO> (
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getViewSaleInfoDaoByMobile?saleId=" + saleId
                        )
                    );
        }
        /// <summary>
        /// 消费凭证——门店
        /// </summary>
        /// <param name="saleId"></param>
        /// <returns></returns>
        public static SaleOrderReportDTO getSaleOrderReportDTOByMobile(String saleId)
        {
            return
                FunctionHelper.JsonDeserialization<SaleOrderReportDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleOrderReportDTOByMobile?saleId=" + saleId
                        )
                    );
        }
        /// <summary>
        /// 创建用户画像基础信息
        /// </summary>
        /// <param name="personaDTO"></param>
        public static String savePersonaInfo(PersonaDTO personaDTO)
        {
            return
                RestCall.PostHttp(
                        URL.接口url + "/customer/savePersonaInfo",
                        FunctionHelper.JsonSerialization(personaDTO)
                        );
        }
        /// <summary>
        /// 电话查询用户画像
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static PersonaDTO findPersonaDTOByMobile(String mobile)
        {
            return
                FunctionHelper.JsonDeserialization<PersonaDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/customer/findPersonaDTOByMobile?mobile=" + mobile
                        )
                    );
        }
        /// <summary>
        /// 上传用户画像正面照片
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="ofd"></param>
        /// <returns></returns>
        public static String saveCustomerFrontPicture(String mobile, OpenFileDialog ofd)
        {
            return
                FileService.UploadRequest(
                    URL.接口url + "/customer/saveCustomerFrontPicture?mobile=" + mobile,
                    ofd.FileName,
                    Path.GetFileName(ofd.FileName),
                    "multipartFile"
                );
        }

        /// <summary>
        /// 查询客户销售订单文件索引
        /// </summary>
        /// <param name="mobile"></param>
        /// <returns></returns>
        public static String findSaleOrderFileById(ViewCustomerDailyAdjustDTO viewCustomerDailyAdjustDTO)
        {
            String id = viewCustomerDailyAdjustDTO.mobile+"_"+viewCustomerDailyAdjustDTO.saleDate;
            //  程序本地目录
            string saveDirectoryPath = @"pdf\";
            下单MTO.Service.PlainMessageResult plainMessageResult =
                FunctionHelper.JsonDeserialization<下单MTO.Service.PlainMessageResult>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/findSaleOrderFileById?id=" + id
                        )
                    );
            if ("200".Equals(plainMessageResult.errorCode))
            {
                //  下载
                String fileName = plainMessageResult.errorMessage;
                //  文件下载
                FileUtil.DownloadPicture(URL.图片url + URL.销售订单文件路径 + fileName, saveDirectoryPath + fileName, -1);
                return saveDirectoryPath + fileName;
            }
            else {
                List<SaleConfirmQueryTitileDTO> saleConfirmQueryTitileDTOs =
                    销售确认Service.getSaleConfirmListByDateTimeStrAndMobile(viewCustomerDailyAdjustDTO.saleDate, viewCustomerDailyAdjustDTO.mobile);
                //  上传
                //  1、生成pdf，保存到savePath
                XtraReport销售订单文件 report = new XtraReport销售订单文件(viewCustomerDailyAdjustDTO);
                //  循环取details并清洗尺寸
                report.DataSource = 销售确认Service.循环取details并freshSize(saleConfirmQueryTitileDTOs);
                report.ExportToPdf(saveDirectoryPath + id + @".pdf");
                //  2、上传pdf文件
                String re = 销售确认Service.saveSaleOrderFile(id, saveDirectoryPath + id + @".pdf");
                //  3、return本地路径
                return saveDirectoryPath + re;
            }
        }
        private static List<SaleConfirmQueryDetailDTO> 循环取details并freshSize(List<SaleConfirmQueryTitileDTO> saleConfirmQueryTitileDTOs)
        {
            List<SaleConfirmQueryDetailDTO> saleConfirmQueryDetailDTOs = new List<SaleConfirmQueryDetailDTO>();
            foreach (SaleConfirmQueryTitileDTO item in saleConfirmQueryTitileDTOs)
            {
                saleConfirmQueryDetailDTOs.AddRange(item.saleConfirmQueryDetailDTOList);
                
            }
            foreach (SaleConfirmQueryDetailDTO item in saleConfirmQueryDetailDTOs)
            {
                if (!String.IsNullOrWhiteSpace(item.styleSizeCd))
                {
                    try { item.styleSizeCd = item.styleSizeCd.Replace("IGS_GROUP_SIZE-", "").Replace("EGS_GROUP_SIZE-", ""); } catch { }
                }
            }
            FunctionHelper.JsonSerialization(saleConfirmQueryDetailDTOs);
            return saleConfirmQueryDetailDTOs;
        }

        /// <summary>
        /// 上传销售订单pdf文件
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="ofd"></param>
        /// <returns></returns>
        public static String saveSaleOrderFile(String id, String filePath)
        {
            return
                FileService.UploadRequest(
                    URL.接口url + "/saleConfirm/saveSaleOrderFile?id=" + id,
                    filePath,
                    Path.GetFileName(filePath),
                    "multipartFile"
                );
        }
        
        /// <summary>
        /// 按照时间取消费记录
        /// </summary>
        /// <param name="orderDate"></param>
        /// <returns></returns>
        public static List<ViewwDailySaleRechargeDTO> getViewDailySaleRechargeByOrderDate(String orderDate)
        {
            return
                FunctionHelper.JsonDeserialization<List<ViewwDailySaleRechargeDTO>>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getViewDailySaleRechargeByOrderDate?orderDate=" + orderDate
                        )
                    );
        }
        /// <summary>
        /// 款式消费统计
        /// </summary>
        /// <param name="styleNameCn"></param>
        /// <returns></returns>
        public static SaleScaleModelDTO getSaleScaleByStyleNameCn(String styleNameCn)
        {
            return
                FunctionHelper.JsonDeserialization<SaleScaleModelDTO>(
                    RestCall.httpGetMethod(
                        URL.接口url + "/saleConfirm/getSaleScaleByStyleNameCn?styleNameCn=" + styleNameCn
                        )
                    );
        }

    }
    /// <summary>
    /// 客户预存余额和会员类型
    /// </summary>
    public class AccountBalanceAndMerbershipDTO
    {
        public Double accountBalance { get; set; }  //  预存金额带免单
        public Double commonAccountBalance { get; set; }  //  预存金额仅充值
        public String membershipType { get; set; }  //  会员类型
        public AccountBalanceAndMerbershipDTO()
        {

        }
    }

    public class CustomerSaleQueryDTO
    {
        public CustomerTagRecordDTO customerTagRecordDTO { get; set; } = new CustomerTagRecordDTO();
        //  发运记录，根据barcode匹配
        public List<DTO.OrderShippedDTO> orderShippedDTOS { get; set; } = new List<DTO.OrderShippedDTO>();
        //  出入库记录，根据barcode匹配
        public List<StockInOutDetailDTO> stockInOutDetailDTOs { get; set; } = new List<StockInOutDetailDTO>();

        public CustomerSaleQueryDTO()
        {
        }
    }
    /// <summary>
    /// 销售员带助记码
    /// </summary>
    public class SalesAssistantDTO
    {
        public String id { get; set; }
        public String name { get; set; }
        public String mnemonic { get; set; }
        public SalesAssistantDTO()
        {

        }
    }

    public class CustomerDailyDiscountDTO
    {
        public String mobile { get; set; }    //   客户电话
        public String dateStamp { get; set; }   //  时间戳
        public String store { get; set; }    //    销售组织
        public String storeName { get; set; }    //    销售组织name
        public String assistant { get; set; }    //    负责人
        public String assistantName { get; set; }    //    负责人name
        public String priceAdjustReason { get; set; }   //  调价原因
        public Double adjustPrice { get; set; } //  调整价格
        public CustomerDailyDiscountDTO()
        {

        }

        public CustomerDailyDiscountDTO(string mobile, string dateStamp, string store, string assistant, string priceAdjustReason, double adjustPrice)
        {
            this.mobile = mobile;
            this.dateStamp = dateStamp;
            this.store = store;
            this.assistant = assistant;
            this.priceAdjustReason = priceAdjustReason;
            this.adjustPrice = adjustPrice;
        }

    }

    /// <summary>
    /// 销售确认BusinessType
    /// </summary>
    public class BusinessTypeConst
    {
        public const String TAG = "套号下单";
        public const String TERMINALSALE = "定制下单";
        public const String CUSTOMERTAG = "客户套号";
        public const String SALEADJUST = "商品调价";
        public const String DEIGNEXPENSES = "设计费用";
    }
    /// <summary>
    /// 现货销售确认暂存
    /// </summary>
    public class GarmentSaleConfirmDTO
    {
        public String mobile { get; set; }
        public String barcode { get; set; }
        public String store { get; set; }
        public String assistant { get; set; }
        public String remarks { get; set; }
        public Boolean isBargain { get; set; }
        public GarmentSaleConfirmDTO()
        {

        }
        public GarmentSaleConfirmDTO(String mobile, String barcode, String store, String assistant, Boolean isBargain)
        {
            this.mobile = mobile;
            this.barcode = barcode;
            this.store = store;
            this.assistant = assistant;
            this.isBargain = isBargain;
        }
    }

    /// <summary>
    /// 定制销售确认暂存
    /// </summary>
    public class CustomerMadeSaleConfirmDTO
    {
        public String refBarcode { get; set; }
        public String styleSizeCd { get; set; }
        public int quantity { get; set; }
        public String remarks { get; set; }
        public String materialCode { get; set; }

        public CustomerMadeSaleConfirmDTO()
        {

        }
        public CustomerMadeSaleConfirmDTO(String refBarcode)
        {
            this.refBarcode = refBarcode;
        }
        public CustomerMadeSaleConfirmDTO(String refBarcode, String styleSizeCd, int quantity, String remarks)
        {
            this.refBarcode = refBarcode;
            this.styleSizeCd = styleSizeCd;
            this.quantity = quantity;
            this.remarks = remarks;
        }
        public CustomerMadeSaleConfirmDTO buildMaterialCode(String materialCode)
        {
            this.materialCode = materialCode;
            return this;
        }
        public CustomerMadeSaleConfirmDTO build(String styleSizeCd, int quantity, String remarks)
        {
            this.styleSizeCd = styleSizeCd;
            this.quantity = quantity;
            this.remarks = remarks;
            return this;
        }

        public CustomerMadeSaleConfirmDTO(GarmentSaleConfirmDTO garmentSaleConfirmDTO)
        {
            this.refBarcode = garmentSaleConfirmDTO.barcode;
            this.quantity = 1;
            this.remarks = garmentSaleConfirmDTO.remarks;
        }
    }

    public class SaleConfirmQueryDetailDTO
    {
        public String id { get; set; }    //
        public String quoteId { get; set; }    //  应用分录id
        public String mobile { get; set; }    //   客户电话
        public DateTime orderDate { get; set; }    //  日期
        public String businessType { get; set; }    // 业务类型    SalesTypeConsts
        public String barcode { get; set; }    //  成衣码
        public String refBarcode { get; set; }    //   参考成衣码
        public String styleNameCn { get; set; }    //  款式
        public String materialCode { get; set; }    // 面料
        public String styleSizeCd { get; set; }    //  尺码
        public Double price { get; set; }    //    金额
        public int quantity { get; set; }    //    数量
        public String store { get; set; }    //    销售组织
        public String storeName { get; set; }    //    销售组织name
        public String assistant { get; set; }    //    负责人
        public String assistantName { get; set; }    //    负责人name
        public String remarks { get; set; }    //  备注
        public Boolean synchronize { get; set; }    //  是否同步销售订单
        public Boolean deprecated { get; set; } //  是否作废
        public String saleOrderDetailId { get; set; }  //  销售分录ID
        public String manufactureOrderId { get; set; }  //  生产订单id
        public SaleConfirmQueryDetailDTO()
        {

        }
    }
    public class SaleConfirmQueryTitileDTO
    {
        public String id { get; set; }    //
        public String quoteId { get; set; }    //  应用分录id
        public String mobile { get; set; }    //   客户电话
        public String customerName { get; set; }   //客户姓名
        public DateTime orderDate { get; set; }    //  日期
        public String businessType { get; set; }    // 业务类型    SalesTypeConsts
        public String barcode { get; set; }    //  成衣码
        public String refBarcode { get; set; }    //   参考成衣码
        public String styleNameCn { get; set; }    //  款式
        public String materialCode { get; set; }    // 面料
        public String materialNameCn { get; set; }  //面料名称
        public String styleSizeCd { get; set; }    //  尺码
        public Double price { get; set; }    //    金额
        public int quantity { get; set; }    //    数量
        public String store { get; set; }    //    销售组织
        public String storeName { get; set; }    //    销售组织name
        public String assistant { get; set; }    //    负责人
        public String assistantName { get; set; }    //    负责人name
        public String remarks { get; set; }    //  备注
        public Boolean synchronize { get; set; }    //  是否同步销售订单
        public Boolean deprecated { get; set; } //  是否作废
        public String saleOrderDetailId { get; set; }  //  销售分录ID
        public String manufactureOrderId { get; set; }  //  生产订单id
        /**
         * 调价
         */
        public Double adjustPrice { get; set; } //  调整价格
        /**
         * 设计
         */
        public Double designPrice { get; set; } //  设计费用

        public List<SaleConfirmQueryDetailDTO> saleConfirmQueryDetailDTOList { get; set; } = new List<SaleConfirmQueryDetailDTO>();
        public SaleConfirmQueryTitileDTO()
        {

        }
    }
    public class SalesQCItemQueryFacadeDTO
    {
        public List<SalesQCItemDTO> salesDailyQCItemDTOS { get; set; } = new List<SalesQCItemDTO>();    //  当日异常
        public List<SalesOrderQCItemDTO> salesOrderQCItemDTOS { get; set; } = new List<SalesOrderQCItemDTO>();  //  销售订单异常
        public List<ViewCustomerDailyAdjustDTO> viewCustomerDailyAdjustDTOS { get; set; } = new List<ViewCustomerDailyAdjustDTO>();   //  销售日记账视图DTO
        public SalesQCItemQueryFacadeDTO()
        {

        }
    }
    public class SaleConfirmInfoDTO
    {
        public List<OrderCommitDTO返回> orderCommitDtos { get; set; } = new List<OrderCommitDTO返回>();
        public List<ProjectInstanceSimpleDTO> projectInstanceSimpleDTOS { get; set; } = new List<ProjectInstanceSimpleDTO>();
        public List<StockInOutDetailDTO> stockInOutDetailDTOS { get; set; } = new List<StockInOutDetailDTO>();
        public List<下单MTO.Service.OrderShippedDTO> orderShippedDTOS { get; set; } = new List<下单MTO.Service.OrderShippedDTO>();

        public SaleConfirmInfoDTO()
        {

        }
    }
    public class SalesQCItemDTO
    {
        public String id { get; set; }
        public String mobile { get; set; }
        public String salComfirmId { get; set; }
        public String dateStamp { get; set; }   //  时间戳
        public String defectCode { get; set; }  //  QC缺陷码，暂时用业务类型中文
        public String status { get; set; }  //  QC状态
        public List<String> statusOptions { get; set; }
        public DateTime createDate { get; set; }  //  日期
        public SalesQCItemDTO()
        {

        }
    }
    public class ViewCustomerDailyAdjustDTO
    {
        public String id { get; set; }    //
        public String mobile { get; set; }    //   客户电话
        public String customerName { get; set; }    // 客户名
        public String saleDate { get; set; }    //  时间戳
        public Double price { get; set; }    // 总价
        public DateTime orderDate { get; set; }    //  日期
        public String businessType { get; set; }    // 业务类型    top.toptimus.constValue.SalesTypeConsts
        public String store { get; set; }    //    销售组织
        public String storeName { get; set; }    //    销售组织name
        public String assistant { get; set; }    //    负责人
        public String assistantName { get; set; }    //    负责人name
        public String priceAdjustReason { get; set; }   //  调价原因
        public Double adjustPrice { get; set; } //  调整价格
        public Boolean containUnSyncCustomerMade { get; set; } //  是否包含未同步套号
        public Double finalPrice { get; set; } //  调整后的最终价格
        public ViewCustomerDailyAdjustDTO()
        {

        }
        public ViewCustomerDailyAdjustDTO build()
        {
            this.finalPrice = this.price + this.adjustPrice;
            return this;
        }
    }
    public class SalesOrderQCItemDTO
    {
        public String id { get; set; }
        public String mobile { get; set; }
        public String salComfirmId { get; set; }
        public String dateStamp { get; set; }   //  时间戳
        public String defectCode { get; set; }  //  QC缺陷码，暂时用业务类型中文
        public String status { get; set; }  //  QC状态
        public List<String> statusOptions { get; set; }
        public DateTime createDate { get; set; }  //  日期

        //  订单信息
        public String refBarcode { get; set; }    // 参考成衣码
        public String styleNameCn { get; set; }    // 款式
        public String materialCode { get; set; }    // 面料
        public String styleSizeCd { get; set; }    // 尺码
        public Double price { get; set; }    // 金额
        public int quantity { get; set; }    // 数量
        public String store { get; set; }    // 销售组织
        public String assistant { get; set; }    // 负责人
        public String remarks { get; set; }    // 备注
        public SalesOrderQCItemDTO()
        {

        }
    }
    public class SaleAdjustDTO
    {
        public String assistant { get; set; }    //
        public Double price { get; set; }    // 
        public String quoteId { get; set; }    //   
        public String remarks { get; set; }    // 
        public String store { get; set; }    //  
        public SaleAdjustDTO()
        {

        }

        public SaleAdjustDTO(string assistant, double price, string quoteId, string remarks, string store)
        {
            this.assistant = assistant;
            this.price = price;
            this.quoteId = quoteId;
            this.remarks = remarks;
            this.store = store;
        }
    }
    public class RefSaleRecordDTO
    {
        public String assistant { get; set; }
        public String assistantName { get; set; }
        public String barcode { get; set; }
        public String businessType { get; set; }
        public Boolean deprecated { get; set; }
        public String id { get; set; }
        public String manufactureOrderId { get; set; }
        public String materialCode { get; set; }
        public String mobile { get; set; }
        public DateTime orderDate { get; set; }
        public String price { get; set; }
        public String quantity { get; set; }
        public String quoteId { get; set; }
        public String refBarcode { get; set; }
        public String remarks { get; set; }
        public String saleOrderDetailId { get; set; }
        public String store { get; set; }
        public String storeName { get; set; }
        public String styleNameCn { get; set; }
        public String styleSizeCd { get; set; }
        public Boolean synchronize { get; set; }
        public RefSaleRecordDTO()
        {

        }
    }
    public class SaleConfirmQueryWholeDTO
    {
        public String id { get; set; }
        public String quoteId { get; set; }
        public String mobile { get; set; }
        public DateTime orderDate { get; set; }
        public String businessType { get; set; }
        public String barcode { get; set; }
        public String refBarcode { get; set; }
        public String styleNameCn { get; set; }
        public String materialCode { get; set; }
        public String styleSizeCd { get; set; }
        public Double price { get; set; }
        public int quantity { get; set; }
        public String store { get; set; }
        public String storeName { get; set; }
        public String assistant { get; set; }
        public String assistantName { get; set; }
        public String sales { get; set; }
        public String salesName { get; set; }
        public String paymentType { get; set; }
        public String remarks { get; set; }
        public Boolean synchronize { get; set; }
        public Boolean deprecated { get; set; }
        public String saleOrderDetailId { get; set; }
        public String manufactureOrderId { get; set; }
        public SaleConfirmQueryWholeDTO()
        {

        }
    }
    public class SaleConfirmExportDTO : SaleConfirmQueryTitileDTO
    {
        //  样衣信息
        public String saleStyleId { get; set; } //  销售款式id  top.toptimus.style.dao.SaleStyleDao.id
        public String saleStyleCode { get; set; }   //  款号，销售定义 top.toptimus.style.dao.SaleStyleDao.saleStyleCode
        public String sampleImagePath { get; set; } //  样衣图片
        public Double salePrice { get; set; }   //  零售价
        //  样衣款式信息
        public String styleTag { get; set; }    //  款式描述
        public String styleSexFlag { get; set; }   //  男 女 男童 女童
        public String styleCategoryId { get; set; } //  款式类别ID
        public String styleCategoryCode { get; set; }   //  款式类别编码
        public String styleCategoryName { get; set; }   //  款式类别名称
        public SaleConfirmExportDTO()
        {

        }
    }
    public class CustomerTagQueryFacadeDTO
    {
        public OrderCommitDTO返回 orderCommitDto { get; set; }  //  生产订单信息
        public CustomerTagRecordDTO barcodeRecords { get; set; }    //  条码对应的销售订单信息
        public List<CustomerTagRecordDTO> relCustomerTagRecordDTOList { get; set; } //  该订单其他的销售订单信息
        public CustomerTagQueryFacadeDTO()
        {

        }
    }

    public class CustomerTagRecordDTO
    {
        public String id { get; set; }
        public String saleConfirmId { get; set; }    // 应用分录id
        public String mobile { get; set; }    //    客户电话
        public String customerName { get; set; }    //  客户姓名
        public String addressProvince { get; set; }
        public String addressCity { get; set; }
        public String addressDistrict { get; set; }
        public String addressDetail { get; set; }
        public String zipCode { get; set; }
        public DateTime orderDate { get; set; }    //   日期
        public String businessType { get; set; }    //  业务类型    SalesTypeConsts
        public String refBarcode { get; set; }    //    参考成衣码
        public String styleNameCn { get; set; }    //   款式
        public String materialCode { get; set; }    //  面料
        public String styleSizeCd { get; set; }    //   尺码
        public Double price { get; set; }    // 金额
        public int quantity { get; set; }    // 数量
        public String store { get; set; }    // 销售组织
        public String storeName { get; set; }    // 销售组织名
        public String assistant { get; set; }    // 负责人
        public String assistantName { get; set; }    // 负责人名
        public String remarks { get; set; }    //   备注
        public DateTime createDate { get; set; }
        public int iIndex { get; set; }    //   描述t_sale_confirm中的的第几件，比如t_sale_confirm中quantity为2，在新表中就应该有两条记录
        public Boolean stockIn { get; set; }    //  默认false，入库时变为true
        public DateTime stockInDate { get; set; }
        public String orderId { get; set; }    //   生产订单id
        public String barcode { get; set; }    //   成衣码
        public CustomerTagRecordDTO()
        {

        }
    }
    public class PersonaDTO
    {
        public String mobile { get; set; }
        /**
         * 客户基础信息
         */
        public String customerCode { get; set; }    //  客户编码
        public String customerName { get; set; }    //  客户名称
        public String wechatName { get; set; }  //  微信名
        public DateTime birthday { get; set; }    //  生日
        public int gender { get; set; }  //  性别 0-女，1-男，2-其他
        /**
         * 客户身材信息
         */
        public Double height { get; set; }      //     身高
        public Double weight { get; set; }      //     体重
        /**
         * 客户受教育程度及职业信息
         */
        public String perfessionId { get; set; }  //     职业id   GB职业编码表
        public String perfessionDescription { get; set; }  //     职业描述
        public String unitAddress { get; set; }  //     单位地址
        public String educationDegreeId { get; set; }     //     受教育程度Id 国家文化程度代码标准表
        public String educationDegree { get; set; }     //     受教育程度
        /**
         * 客户推荐人及销售顾问信息
         */
        public String salesConsultantId { get; set; }    //     销售顾问Id  top.toptimus.publicCloudService.jpa.dao.aliyun.shop.SalesAssistantDao
        public String salesConsultantName { get; set; }    //     销售顾问
        public String recommenderMobile { get; set; }  //    推荐人电话
        public String recommenderName { get; set; }     //     推荐人姓名
        /**
         * 图片信息
         */
        public String frontPicUrl { get; set; }   //  正面照片
        public String backPicUrl { get; set; }   //  背面照片
        public PersonaDTO()
        {

        }

        public PersonaDTO buildBasicInfo(
            String wechatName,
            int gender)
        {
            if (!String.IsNullOrWhiteSpace(wechatName))
            {
                this.wechatName = wechatName;
            }
            this.gender = gender;
            return this;
        }
        public PersonaDTO buildBirthday(
            String birthday
            )
        {
            if (!String.IsNullOrWhiteSpace(birthday))
            {
                try { this.birthday = DateTime.ParseExact(birthday, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); } catch { }
            }
            return this;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="height"></param>
        /// <param name="weight"></param>
        /// <returns></returns>
        public PersonaDTO buildFigureInfo(
            String height,
            String weight
            )
        {
            if (!String.IsNullOrWhiteSpace(height))
            {
                try { this.height = Convert.ToDouble(height); } catch { }
            }
            if (!String.IsNullOrWhiteSpace(weight))
            {
                try { this.weight = Convert.ToDouble(weight); } catch { }
            }
            return this;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="salesConsultantId"></param>
        /// <param name="salesConsultantName"></param>
        /// <returns></returns>
        public PersonaDTO buildSalesInfoAssistant(
            String salesConsultantId,
            String salesConsultantName
            )
        {
            if (!String.IsNullOrWhiteSpace(salesConsultantId))
            {
                this.salesConsultantId = salesConsultantId;
            }
            if (!String.IsNullOrWhiteSpace(salesConsultantName))
            {
                this.salesConsultantName = salesConsultantName;
            }
            return this;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="recommenderMobile"></param>
        /// <param name="recommenderName"></param>
        /// <returns></returns>
        public PersonaDTO buildSalesInfo(
            String recommenderMobile,
            String recommenderName
            )
        {
            if (!String.IsNullOrWhiteSpace(recommenderMobile))
            {
                this.recommenderMobile = recommenderMobile;
            }
            if (!String.IsNullOrWhiteSpace(recommenderName))
            {
                this.recommenderName = recommenderName;
            }
            return this;
        }
    }
    public class CustomerSaleOrderReportDetailDTO
    {
        public String serviceType { get; set; }
        public String styleNameCn { get; set; }
        public String materialNameCn { get; set; }
        public String styleSizeCd { get; set; }
        public int quantity { get; set; }
        public Double actualPay { get; set; }
        public String paymentType { get; set; }
        public CustomerSaleOrderReportDetailDTO()
        {

        }
    }
    public class CustomerSaleOrderReportDTO
    {
        /*
         *  客户信息
         */
        public String mobile { get; set; }
        public String customerName { get; set; }
        public String customerAddress { get; set; }
        public Double accountBalance { get; set; }  //  预存金额
        public Double commonAccountBalance { get; set; }  //  预存不免单金额
        public String membershipType { get; set; }  //  会员类型
        public String orderDate { get; set; }
        public String printDate { get; set; }

        /*
         *  销售组织信息
         */
        public String store { get; set; }
        public String assistant { get; set; }

        /**
         * 订单明细
         */
        public List<CustomerSaleOrderReportDetailDTO> customerSaleOrderReportDetailDTOList { get; set; } = new List<CustomerSaleOrderReportDetailDTO>();
        public CustomerSaleOrderReportDTO()
        {

        }
    }
    public class ViewSaleInfoDTO
    {
        public String id { get; set; }
        public String businessType { get; set; }
        public String barcode { get; set; }
        public String styleNameCn { get; set; }
        public String materialCode { get; set; }
        public String styleSizeCd { get; set; }
        public int quantity { get; set; }
        public DateTime orderDate { get; set; }
        public Double salePrice { get; set; }
        public Double totalPrice { get; set; }
        public Double adjust_price { get; set; }
        public Double design_price { get; set; }
        public Double actualPay { get; set; }
        public String paymentType { get; set; }
        public String sales { get; set; }
        public String mobile { get; set; }
        public String customerName { get; set; }
        public String addressProvince { get; set; }
        public String addressCity { get; set; }
        public String addressDistrict { get; set; }
        public String addressDetail { get; set; }
        public String store { get; set; }
        public String assistant { get; set; }
        public ViewSaleInfoDTO()
        {

        }
    }
    public class SaleOrderReportDTO
    {
        public String mobile { get; set; }
        public String customerName { get; set; }
        public String customerAddress { get; set; }
        public Double accountBalance { get; set; }  //  预存金额
        public Double commonAccountBalance { get; set; }  //  预存不免单金额
        public String membershipType { get; set; }  //  会员类型
        public String orderDate { get; set; }
        public String printDate { get; set; }

        /*
         *  销售组织信息
         */
        public String store { get; set; }
        public String assistant { get; set; }

        /**
         * 订单明细
         */
        public List<SaleOrderReportDetailDTO> saleOrderReportDetailDTOS { get; set; } = new List<SaleOrderReportDetailDTO>();
        public SaleOrderReportDTO()
        {

        }
    }
    public class SaleOrderReportDetailDTO
    {
        public String businessType { get; set; }
        public String barcode { get; set; }
        public String styleNameCn { get; set; }
        public String materialCode { get; set; }
        public String styleSizeCd { get; set; }
        public int quantity { get; set; }
        public DateTime orderDate { get; set; }
        public Double salePrice { get; set; }
        public Double totalPrice { get; set; }
        public Double adjust_price { get; set; }
        public Double design_price { get; set; }
        public Double actualPay { get; set; }
        public String paymentType { get; set; }
        public SaleOrderReportDetailDTO()
        {

        }
    }
    public class SaleConfirmQueryTitileWithBalanceDTO
    {
        public Double balance { get; set; }
        public List<SaleConfirmQueryTitileDTO> saleConfirmQueryTitileDTOS { get; set; } = new List<SaleConfirmQueryTitileDTO>();
        public SaleConfirmQueryTitileWithBalanceDTO()
        {

        }
    }
    public class CustomerDailyAccountDTO
    {
        public String orderDate { get; set; }
        public String store { get; set; }
        public String businessType { get; set; }
        public String paymentType { get; set; }
        public String barcode { get; set; }
        public String styleNameCN { get; set; }
        public String materialCode { get; set; }
        public String styleSizeCd { get; set; }
        public String quantity { get; set; }
        public String salePrice { get; set; }
        public String totalPrice { get; set; }
        public String adjust_price { get; set; }
        public String design_price { get; set; }
        public String actualPay { get; set; }
        public String mobile { get; set; }
        public String customerName { get; set; }
        public CustomerDailyAccountDTO()
        {

        }
        public CustomerDailyAccountDTO(DataRow dataRow)
        {
            this.orderDate = dataRow["orderDate"].ToString();
            this.store = dataRow["store"].ToString();
            this.businessType = dataRow["businessType"].ToString();
            this.paymentType = dataRow["paymentType"].ToString();
            this.barcode = dataRow["barcode"].ToString();
            this.styleNameCN = dataRow["styleNameCN"].ToString();
            this.materialCode = dataRow["materialCode"].ToString();
            this.styleSizeCd = dataRow["styleSizeCd"].ToString();
            this.quantity = dataRow["quantity"].ToString();
            this.salePrice = dataRow["salePrice"].ToString();
            this.totalPrice = dataRow["totalPrice"].ToString();
            this.adjust_price = dataRow["adjust_price"].ToString();
            this.design_price = dataRow["design_price"].ToString();
            this.actualPay = dataRow["actualPay"].ToString();
            this.mobile = dataRow["mobile"].ToString();
            this.customerName = dataRow["customerName"].ToString();
        }
    }
    public class ViewwDailySaleRechargeDTO
    {
        public String customerCode { get; set; }    //  客户编码
        public String mobile { get; set; }
        public String customerName { get; set; }
        public String address { get; set; } //  地址
        public Double accountBalance { get; set; }  //  预存金额
        public Double commonAccountBalance { get; set; }  //  预存不免单金额
        public String membershipType { get; set; }  //  会员类型

        public String id { get; set; }
        public String orderDate { get; set; }   //  日期
        public String store { get; set; }   //  销售组织
        public String businessType { get; set; }    //  业务类型
        public String paymentType { get; set; } //  支付类型
        public String barcode { get; set; } //  成衣码
        public String styleNameCN { get; set; } //  款式
        public String materialCode { get; set; }    //  面料
        public String styleSizeCd { get; set; } //  尺码
        public String quantity { get; set; }    //  数量
        public String salePrice { get; set; }   //  零售价
        public String totalPrice { get; set; }  //  总价
        public String adjustPrice { get; set; }    //  价格调整
        public String designPrice { get; set; }    //  设计费用
        public String actualPay { get; set; }   //  实付价格
        public ViewwDailySaleRechargeDTO()
        {

        }
    }
    public class ViewwDailySaleRechargeInfoDTO
    {
        public String customerCode { get; set; }    //  客户编码
        public String mobile { get; set; }
        public String customerName { get; set; }
        public String address { get; set; } //  地址
        public Double accountBalance { get; set; }  //  预存金额
        public Double commonAccountBalance { get; set; }  //  预存不免单金额
        public String membershipType { get; set; }  //  会员类型

        public String id { get; set; }
        public String orderDate { get; set; }   //  日期
        public String store { get; set; }   //  销售组织
        public String businessType { get; set; }    //  业务类型
        public String paymentType { get; set; } //  支付类型
        public String barcode { get; set; } //  成衣码
        public String styleNameCN { get; set; } //  款式
        public String materialCode { get; set; }    //  面料
        public String styleSizeCd { get; set; } //  尺码
        public String quantity { get; set; }    //  数量
        public String salePrice { get; set; }   //  零售价
        public String totalPrice { get; set; }  //  总价
        public String adjustPrice { get; set; }    //  价格调整
        public String designPrice { get; set; }    //  设计费用
        public String actualPay { get; set; }   //  实付价格
        public String membershipInfo { get; set; }    //  价格调整
        public String styleInfo { get; set; }    //  设计费用
        public String paymentInfo { get; set; }   //  实付价格
        public ViewwDailySaleRechargeInfoDTO(ViewwDailySaleRechargeDTO viewwDailySaleRechargeDTO)
        {
            this.customerName = viewwDailySaleRechargeDTO.customerName;
            this.mobile = viewwDailySaleRechargeDTO.mobile;
            this.membershipInfo =
                "会员类型：" + viewwDailySaleRechargeDTO.membershipType + "\n" +
                "会员编码：" + viewwDailySaleRechargeDTO.customerCode + "\n" +
                "预存金额：" + viewwDailySaleRechargeDTO.accountBalance;
            this.address = viewwDailySaleRechargeDTO.address;
            if ("定制".Equals(viewwDailySaleRechargeDTO.businessType))
            {
                this.styleInfo =
                                "款式名称：" + viewwDailySaleRechargeDTO.styleNameCN + "\n" +
                                "面料号：" + viewwDailySaleRechargeDTO.materialCode + "\n" +
                                "数量：" + viewwDailySaleRechargeDTO.quantity + "    尺码：" + viewwDailySaleRechargeDTO.styleSizeCd + "\n" +
                                "零售价：" + viewwDailySaleRechargeDTO.salePrice;
            }
            else
            {
                this.styleInfo =
                                "款式名称：" + viewwDailySaleRechargeDTO.styleNameCN + "\n" +
                                "面料号：" + viewwDailySaleRechargeDTO.materialCode + "\n" +
                                "数量：" + viewwDailySaleRechargeDTO.quantity + "    尺码：" + viewwDailySaleRechargeDTO.styleSizeCd + "\n" +
                                "零售价：" + viewwDailySaleRechargeDTO.salePrice + "    成衣码：" + viewwDailySaleRechargeDTO.barcode;
            }
            this.paymentInfo =
                "总计：" + viewwDailySaleRechargeDTO.totalPrice + "\n" +
                "设计费用：" + viewwDailySaleRechargeDTO.designPrice + "    价格调整：" + viewwDailySaleRechargeDTO.adjustPrice + "\n" +
                "支付类型：" + viewwDailySaleRechargeDTO.paymentType;
            this.store = viewwDailySaleRechargeDTO.store;
            this.businessType = viewwDailySaleRechargeDTO.businessType;
            this.actualPay = viewwDailySaleRechargeDTO.actualPay;
        }
    }
    public class SaleScaleModelDTO
    {
        //  本日销量合计
        public List<SaleScaleDTO> currentDaySaleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  本月销量合计
        public List<SaleScaleDTO> currentMonthSaleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  上月销量合计
        public List<SaleScaleDTO> lastMonthSaleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  本季度销量合计
        public List<SaleScaleDTO> currentSeasonSaleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  上季度销量合计
        public List<SaleScaleDTO> lastSeasonSaleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  全部销量合计
        public List<SaleScaleDTO> saleScaleDTOS { get; set; } = new List<SaleScaleDTO>();
        //  库存统计
        public List<SaleStockScaleDTO> saleStockScaleDTOS { get; set; } = new List<SaleStockScaleDTO>();
    }

    public class SaleStockScaleDTO
    {
        public String storeId { get; set; }    // 门店ID
        public String storeName { get; set; }   //  门店名称
        public String styleNameCn { get; set; }    // 款式
        public String materialCode { get; set; }    // 面料
        public String styleSizeCd { get; set; }    // 尺码
        public int quantity { get; set; }    // 数量
        public SaleStockScaleDTO()
        {

        }
    }
    public class SaleScaleDTO
    {
        public String businessType { get; set; }    // 业务类型    SalesTypeConsts
        public String styleNameCn { get; set; }    // 款式
        public String materialCode { get; set; }    // 面料
        public String styleSizeCd { get; set; }    // 尺码
        public int quantity { get; set; }    // 数量
        public SaleScaleDTO()
        {

        }
    }
}

